package com.api.task.edittask;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.ITaskApiService;
import com.zyncro.api.exceptions.NoTaskManagerPermissionApiException;
import com.zyncro.api.exceptions.ZyncroApiException;
import com.zyncro.api.model.TaskApiType;
import com.zyncro.api.model.TaskStatusApiType;

@ContextConfiguration(locations = { "classpath:/task/task-context.xml" })
public class EditTaskNotParticipant extends AbstractApiTest {

	@Value("#{group_toEdit[notParticipant].appId}")
	private String notParticipantUrn;

	@Value("#{group_toEdit[notParticipant].password}")
	private String notParticipantPassword;

	@Value("#{group_toEdit.taskUrn}")
	private String groupTaskUrn;

	@BeforeClass
	protected void setParameters() throws Exception {

		getApi().login(notParticipantUrn, notParticipantPassword);
	}

	@Test(expectedExceptions = { NoTaskManagerPermissionApiException.class })
	public void testEditTask() throws ZyncroApiException {

		String title = "jaja";
		String description = "jeje";
		String responsible = null;
		String responsibleText = null;
		String dueDate = null;
		TaskApiType type = TaskApiType.TASK;
		TaskStatusApiType status = TaskStatusApiType.PENDING;
		String following = null;

		getApi().getService(ITaskApiService.class).editTask(groupTaskUrn, title, description, responsible, responsibleText, dueDate, type,
				status, following);
	}
}
